package com.qf.microuser.user.controller;

import com.qf.common.core.common.R;
import com.qf.common.core.util.UserUtils;
import com.qf.microuser.user.service.UserPointsLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 天--道--酬--勤
 *
 * @author LiangGaoQiang
 * @ClassName UserPointsLogController
 * @Date: 2025/5/26 20:48
 * @Description: 用户积分日志控制器
 */
@RestController
@RequestMapping("/user/userPointsLog")
public class UserPointsLogController {

    @Autowired
    private UserPointsLogService userPointsLogService;
    @PostMapping("/sign")
    public R userSign() {
        Boolean result =userPointsLogService.userSign();
        if (!result) {
            return R.fail();
        }
        return R.ok();
    }


    /**
     * 查询用户是否签到
     * @return
     */
    @PostMapping("/findSign")
    public R findSign() {
        Integer uid = UserUtils.getUid();
        if (uid == null) {
            return R.fail();
        }
        Boolean result =userPointsLogService.findSign(uid);
        if (!result) {
            return R.fail();
        }
        return R.ok();
    }
}
